package com.youlu.campus.admin.english;

import com.youlu.campus.common.base.RestResult;
import com.youlu.campus.common.base.RestResultBuilder;
import com.youlu.campus.entity.english.vo.request.ActivityGroupCreatedCommand;
import com.youlu.campus.service.english.ActivityGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
public class ActivityGroupController {

    @Autowired
    private ActivityGroupService activityGroupService;

    @GetMapping("/activity-group/list")
    public RestResult groupList(){
        return RestResultBuilder.builder().success().data(activityGroupService.groupList(null)).build();
    }

    /**
     * 竞赛组答题配置
     * @param createdCommand
     * @return
     */
    @PostMapping("/activity-group/qa-config/save")
    public RestResult save(@RequestBody ActivityGroupCreatedCommand createdCommand){
        activityGroupService.save(createdCommand);
        return RestResultBuilder.builder().success().build();
    }

    @GetMapping("/activity-group/qa-config/list")
    public RestResult list(){
        return RestResultBuilder.builder().success().data(activityGroupService.list()).build();
    }
    @GetMapping("/activity-group/qa-config/detail")
    public RestResult detail(@RequestParam String activityGroupId){
        return RestResultBuilder.builder().success().data(activityGroupService.detail(activityGroupId)).build();
    }

}
